<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>氦闪</title>
    <link rel="icon" href="__PUBLIC__/web/images/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="__PUBLIC__/web/css/public.css">
    <link rel="stylesheet" href="__PUBLIC__/web/css/login.css">
</head>
<body>
<header>
    <div class="ly-logo">
        <a href="index.html"><img src="__PUBLIC__/web/images/logo.png" title="氦闪"/></a>
    </div>
    <div class="ly-top">
        <!-- 未登录状态-->
        <ul class="ly-menu">
            <li><a href="personal.html">个人中心</a></li>
            <li><a href="login.html">登录</a></li>
            <li><a href="register.html">注册</a></li>
        </ul>
        <!--登录状态-->
        <!--<ul class="ly-menu">-->
        <!--<li><a style="color: #d43f3a" href="personal.html">氦闪用户名</a></li>-->
        <!--<li><a href="contact.html">联系我们</a></li>-->
        <!--<li><a href="follow.html">关注氦闪</a></li>-->
        <!--</ul>-->
        <div class="ly-shop-car">
            <a href="shop.html"><img src="__PUBLIC__/web/images/icon_car.png"/><span>0</span></a>
        </div>
    </div>
</header>


<div class="ly-master">
    <ul class="ly-nav">
        <li>
            <h1>服装索引</h1>
            <dd>系列</dd>
            <dl>
                <dt><a href="index.html">氦闪</a></dt>
                <dt><a href="index.html">聚变</a></dt>
                <dt><a href="index.html">耀闪</a></dt>
            </dl>
        </li>
        <li>
            <dd><a href="rules.html">选号规则</a></dd>
            <dd><a href="story.html">品牌故事</a></dd>
            <dd><a href="notice.html">购买须知</a></dd>
        </li>
    </ul>
</div>

<section>
    <div class="ly-content">
        <div class="ly-title">
            登录
        </div>
        <div class="ly-register">
            <ul class="ly-list">
                <h1>我是氦闪的用户</h1>
                <p>请输入您的登录名和密码来登陆。</p>
                <li>
                    <input type="text" class="ly-input" id="username" name="username" placeholder="用户名"/>
                </li>
                <li>
                    <input type="password" class="ly-input" id="password"  name="password" placeholder="密码"/>
                    <h2><a href="{:U('getpassword')}">忘记密码？</a></h2>
                </li>
                <li>
                    <a class="ly-submit" onclick="return publish(this.form)">登录</a>
                </li>
                <li>登录有疑问，请直接 <a href="contact.html" class="ly-a">联系我们</a></li>
            </ul>
        </div>
    </div>

    <include file="Index/footer"/>
</section>

<div class="ly-menu-nav" data-id="1">
    <img src="__PUBLIC__/web/images/icon_menu.png" />
</div>
</body>
<script src="__PUBLIC__/web/js/jquery.min.js"></script>
<script src="__PUBLIC__/web/js/public.js"></script>
<script>
    function publish(obj) {
//				console.log(11);return false;
        var username = $("#username").val();
        var password = $("#password").val();
        var telReg = /^1(3[0-9]|4[57]|5[0-35-9]|7[0135678]|8[0-9])\d{8}$/;//console.log(password);return false;
        var pwdReg=/(?!^[0-9]+$)(?!^[A-z]+$)(?!^[^A-z0-9]+$)^.{6,18}$/;
        var $YourForm = $("#YourForm").serialize();
        $.ajax({
            type: 'post',
            url: "{:U('Index/doLogin')}",
            data: {password: password, username: username },
            dataType: "json",//后台提供传输类型
//                jsonp: "jsoncallback",//跨域
            timeout: 30000,
            // 发起请求前就调用
            beforeSend: function (data) {
                //判断输入框是否为空
                if (!password || !username) {
                    alert("信息不完整！！！");
                    return false;
                }
                /*//判断手机号码是否符合
                if (!telReg.test(username)) {
                    alert("请输入正确的手机号码");
                    return false;
                }
                if(password.length < 6 || password.length > 18) {
                    alert("请输入6~18位密码");
                    return false;
                }*/

            },
            success: function (data) {
                //var data = JSON.parse(data);
                if (data.code == 200) {
                    // alert('登录成功');
                    setTimeout(refer, 1000);
//						history.go(-1);
//						window.location.reload();
//						self.location=document.referrer;
//						setTimeout(window.location.href =  "{:U('Weixin/Personal/index')}", 3000);// "{:U(Weixin/Member/login)}";
                } else {
                    alert(data.mark);
                }
            },
            complete: function () { // 请求完成时会调用
            },
            error: function () {
            }
        });
        return false;
    }

    function refer() {
        window.location.href="{:U('Index/home')}";
    }
</script>
</html>





